package com.xveshe.admin.service.impl;

import java.util.List;
import java.util.UUID;

import com.xveshe.common.utils.DateUtils;
import com.xveshe.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xveshe.admin.mapper.XsglDsgxszMapper;
import com.xveshe.admin.domain.XsglDsgxsz;
import com.xveshe.admin.service.IXsglDsgxszService;

/**
 * 导师关系设置Service业务层处理
 *
 * @author geyasong
 * @date 2024-11-06
 */
@Service
public class XsglDsgxszServiceImpl implements IXsglDsgxszService
{
    @Autowired
    private XsglDsgxszMapper xsglDsgxszMapper;

    /**
     * 查询导师关系设置
     *
     * @param id 导师关系设置主键
     * @return 导师关系设置
     */
    @Override
    public XsglDsgxsz selectXsglDsgxszById(String id)
    {
        return xsglDsgxszMapper.selectXsglDsgxszById(id);
    }

    /**
     * 查询导师关系设置列表
     *
     * @param xsglDsgxsz 导师关系设置
     * @return 导师关系设置
     */
    @Override
    public List<XsglDsgxsz> selectXsglDsgxszList(XsglDsgxsz xsglDsgxsz)
    {
        return xsglDsgxszMapper.selectXsglDsgxszList(xsglDsgxsz);
    }

    /**
     * 新增导师关系设置
     *
     * @param xsglDsgxsz 导师关系设置
     * @return 结果
     */
    @Override
    public int insertXsglDsgxsz(XsglDsgxsz xsglDsgxsz)
    {
        xsglDsgxsz.setId(UUID.randomUUID().toString());
        //获取用户账号xsglXslb.setCreator(SecurityUtils.getUsername());
        //获取用户昵称
        xsglDsgxsz.setCreator(SecurityUtils.getLoginUser().getUser().getNickName());
        xsglDsgxsz.setCreatedate(DateUtils.getNowDate());
        return xsglDsgxszMapper.insertXsglDsgxsz(xsglDsgxsz);
    }

    /**
     * 修改导师关系设置
     *
     * @param xsglDsgxsz 导师关系设置
     * @return 结果
     */
    @Override
    public int updateXsglDsgxsz(XsglDsgxsz xsglDsgxsz)
    {
        xsglDsgxsz.setLastmodifier(SecurityUtils.getLoginUser().getUser().getNickName());
        xsglDsgxsz.setLastmodifieddate(DateUtils.getNowDate());
        return xsglDsgxszMapper.updateXsglDsgxsz(xsglDsgxsz);
    }

    /**
     * 批量删除导师关系设置
     *
     * @param ids 需要删除的导师关系设置主键
     * @return 结果
     */
    @Override
    public int deleteXsglDsgxszByIds(String[] ids)
    {
        return xsglDsgxszMapper.deleteXsglDsgxszByIds(ids);
    }

    /**
     * 删除导师关系设置信息
     *
     * @param id 导师关系设置主键
     * @return 结果
     */
    @Override
    public int deleteXsglDsgxszById(String id)
    {
        return xsglDsgxszMapper.deleteXsglDsgxszById(id);
    }
}
